package com.zzld.modules.autoinn.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zzld.core.service.BaseServiceImpl;
import com.zzld.modules.autoinn.entity.Collar;
import com.zzld.modules.autoinn.mapper.CollarMapper;
import com.zzld.modules.autoinn.service.ICollarService;

@Service("collarService")
public class CollarServiceImpl  extends BaseServiceImpl<Collar> implements ICollarService{

	@Autowired
	private CollarMapper collarMapper;
	
	public Collar selectbywx(Map<String,Object> map){
		try{
	     Collar c = collarMapper.selectbywx(map);
		 return c;
		}catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
	
	public Integer updatebystate(Integer state,String couponid){
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("state", state);
		map.put("id", couponid);
		return collarMapper.updatebystate(map);
	}
	
	public List<Collar> selectbycouid(String counponid){
		return collarMapper.selectbycouid(counponid);
	}
	

	
	

	public List<Collar> selectbycouopen(String counponid, String openid,
			String customerId) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("counponid", counponid);
		map.put("openid", openid);
		map.put("customerId", customerId);
		// TODO 自动生成的方法存根
		return collarMapper.selectbycouopen(map);
	}
	public PageInfo list(Map<String,Object> map, int PageNum, int PageSize) {		
		PageHelper.startPage(PageNum, PageSize);
		List<Collar> list =collarMapper.selectlist(map);
		
		PageInfo page = new PageInfo(list);
		return page;
	}
	
	
}
